package com.example.expandablelistview.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

import com.example.expandablelistview.R;

public class ActEdit extends Activity {
	EditText mEdit;
	Intent intent;

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.actedit);
		intent = getIntent();
		mEdit = (EditText) findViewById(R.id.actedit_edit);
		String text = intent.getStringExtra("TextIn");
		if (text != null)
			mEdit.setText(text);
	}

	public void mOnClick(View v) {
		switch (v.getId()) {
		case R.id.actedit_okbtn:
			intent = new Intent();
			intent.putExtra("TextOut", mEdit.getText().toString());
			setResult(RESULT_OK, intent);
			break;
		case R.id.actedit_cancelbtn:
			setResult(RESULT_CANCELED);
			break;
		}
		finish();
	}

}
